﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace nadModel.pad
{
    public partial class ReturnMtlProcess : AbstractEntityProcess
    {
        public string conection_addr = "http://nad.nadfinlo.com.cn/nad/";
        public ReturnMtlEntity[] FindByParameter(MaterialRequisitionParameter p)
        {
            string sql = " select * from " + ReturnMtlEntity.DB_TABLES + " where company='" + p.company + "' "
                           + " and (" + ReturnMtlEntity.RECEIVE_NO + ">='" + p.IssueNoFrom + "' or '" + p.IssueNoFrom + "'='' ) "
                           + " and (" + ReturnMtlEntity.RECEIVE_NO + "<='" + p.IssueNoTo + "' or '" + p.IssueNoTo + "'='' )"
                           + " and (" + ReturnMtlEntity.DATE_01 + ">='" + p.CreateTimeFrom + "' or '" + p.CreateTimeFrom + "'='' )"
                           + " and (" + ReturnMtlEntity.DATE_01 + "<='" + p.CreateTimeTo + "' or '" + p.CreateTimeTo + "'='' )"
                           + " and (" + ReturnMtlEntity.JOB_NUM + ">='" + p.JobFrom + "' or '" + p.JobFrom + "'='' )"
                           + " and (" + ReturnMtlEntity.JOB_NUM + "<='" + p.JobTo + "' or '" + p.JobTo + "'='' )"
                           + " and (" + ReturnMtlEntity.MTL_PARTNUM + ">='" + p.PartFrom + "' or '" + p.PartFrom + "'='' )"
                           + " and (" + ReturnMtlEntity.MTL_PARTNUM + "<='" + p.PartTo + "' or '" + p.PartTo + "'='' )";

            ReturnMtlEntity[] ents = (ReturnMtlEntity[])FindBySql(sql,conection_addr);
            return ents;
        }


    }
}
